package com.wc.alorithm_blue_bridge_history.littlewhite.Q231209.Q9492;

import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/12/9-19:53
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long preNum = 0;
        int n = sc.nextInt();
        int first = sc.nextInt();
        BigDecimal mulDecimal = new BigDecimal(first);
        BigDecimal preDecimal = new BigDecimal(first);
        BigDecimal ans = new BigDecimal(0);
        while (--n > 0) {
            int num = sc.nextInt();
            mulDecimal = preDecimal.multiply(new BigDecimal(num));
            preDecimal = preDecimal.add(new BigDecimal(num));
            ans = ans.add(mulDecimal);
        }

        System.out.println(ans);
    }
}
